//
//  SZChannelModel.m
//  03-仿网易新闻
//
//  Created by ItHeiMa on 2017/1/3.
//  Copyright © 2017年 itHeima. All rights reserved.
//

#import "SZChannelModel.h"


@implementation SZChannelModel

- (NSString *) description {
    return  [self yy_modelDescription];
}

+ (NSArray *) channelList {
    //NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"topic_news.json" ofType:nil];
    //NSData *data = [NSData dataWithContentsOfFile:jsonPath options:0 error:NULL];

    NSURL *jsonURL = [[NSBundle mainBundle] URLForResource:@"topic_news.json" withExtension:nil];
    //从服务器同步获取数据的方法：
    NSData *data = [NSData dataWithContentsOfURL:jsonURL];
    //获取频道的字典数组
    NSArray *channelDicArr = [[NSJSONSerialization JSONObjectWithData:data options:0 error:NULL] objectForKey:@"tList"];
    //字典转模型
    //yy_modelArrayWithClass: 需要转成模型的 class; json: 字典数组
    NSArray *modelArray = [NSArray yy_modelArrayWithClass:[SZChannelModel class] json:channelDicArr];
    
    return modelArray;
}

@end
